# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=vnstat
pkgver=2.6
pkgrel=1
pkgdesc="Console-based network traffic monitor"
url="http://humdi.net/vnstat"
arch="all"
license="GPL-2.0-or-later"
install="$pkgname.pre-install"
options="!check" # make check is usesless
makedepends="sqlite-dev gd-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="http://humdi.net/vnstat/vnstat-$pkgver.tar.gz
	vnstatd.initd
	vnstatd.confd"

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make
}

package() {
	make DESTDIR="$pkgdir" install

	install -D -m0755 "$srcdir"/vnstatd.initd \
		"$pkgdir"/etc/init.d/vnstatd
	install -D -m0644 "$srcdir"/vnstatd.confd \
		"$pkgdir"/etc/conf.d/vnstatd

	install -D -m0755 examples/vnstat.cgi \
		"$pkgdir"/usr/share/doc/vnstat/examples/vnstat.cgi
}

check() {
	make check
}

sha512sums="1a62fc9c2379b050208945e85bad04f602a0f2c71e6bd069d241c1df77c76ec6258948fc3fdf633b15c52665782cae4f995a916103d330bfb46cab0291d3a1ea  vnstat-2.6.tar.gz
b7372c7638a56ebe00642d871ff94589b6a5a402bff32f01383bdb87af01de55fd3dc88884693604bd154f28dad2ba503a2f761fd39576a0512538fc89ed4ddc  vnstatd.initd
d645817913d5b52e928561b3d6a0e869d8ae5db81b97af91c1ebfc6a8cd2df666c1653e6dc5f91c0a890033a89692f77eaf081c1cae5590446c69a70ea263946  vnstatd.confd"
